package com.hockeo.server.servlet.convert;

import com.hockeo.server.data.DAO;

/**
 * Factory that creates GWT converter objects.
 *
 * @version $Id$
 * @author jjanke
 */
public class GwtConverterFactory
{
  private static Gwt2JConverter d_gwt2j;
  private static J2GwtConverter d_j2gwt;

  /**
   * Returns a converter that can be used to convert GWT client side instances into server
   * side Java entities.
   */
  public Gwt2JConverter getGwt2JConverter()
  {
    if ( d_gwt2j == null )
      d_gwt2j = new Gwt2JConverter( DAO.get() );

    return d_gwt2j;
  }

  /**
   * Returns a converter that can be used to convert Java entities into GWT client side
   * instances.
   */
  public J2GwtConverter getJ2GwtConverter()
  {
    if ( d_j2gwt == null )
      d_j2gwt = new J2GwtConverter( DAO.get() );

    return d_j2gwt;
  }
}
